import React, { useState,useEffect } from 'react'
// let {useState} = React;

export default function MyHook() {
  const [sum, setSum] = useState(0)
  const [name, setName] = useState("test")
  useEffect(() => {
    console.log(1111)
    return () => {
      
    }
  }, [sum])
  useEffect(() => {
    console.log(2222)
    return () => {
      
    }
  },[])
  const add =()=>{
    setSum(sum+3)
  }
  return (
    <div onClick={add}>
      myHook:{sum} - {name}
    </div>
  )
}
